<template>
	<view class="mypop">
		<u-popup :show="showPop" mode="bottom" height="400px" customStyle="width:100%" :round="10">
			<view class="p-3">
				<view class="" style='position: absolute;right: 40rpx;z-index: 10;'>
					<u-icon name="close" size="20" @click="refuse"></u-icon>
				</view>
				<view class="title" style="text-align: center;color: #081738;font-weight: 500;">
					{{title}}
				</view>
				<scroll-view scroll-y="false" style="height: 400px;">
					<view class="scroll-content">
						<view class="center">
							<view class="title">
								全部商品
							</view>
							<view class="list" v-for="(item,index) in list" :key="index">
								<view class="item">
									<view class="name">
										{{item.name}}
									</view>
									<view class="price">
										¥{{item.price}}.00
									</view>
								</view>
								<view class="check" @click="checkedType(index)">
									<radio value="item.value" :checked="item.checked" />
								</view>
							</view>
						</view>
					</view>
				</scroll-view>
				<view class="jc-sb" style="align-items: center;">
					<view style="width: 30%;margin-right: 20rpx;color: #3BA199;font-weight: 600;font-size: 40rpx;">
						¥150.00
					</view>
					<view style="width: 35%;">
						<u-button class="custom-style" text="立即支付" color="#fff"
							customStyle="background: linear-gradient(90deg, #2CB9A4 0%, #2CB9A4 100%);color:#fff;border-radius: 20px;">
						</u-button>
					</view>
				</view>
			</view>
		</u-popup>
	</view>
</template>


<script>
	import {
		getWxPhone
	} from '@/request/api.js'
	export default {
		props: ['showPop', 'title', 'tip'],
		data() {
			return {
				show: false,
				value: '',
				list: [{
						name: '店铺单次卡',
						price: 20,
						checked: true
					},
					{
						name: '店铺单次卡',
						price: 20,
						checked: true
					},
					{
						name: '店铺单次卡',
						price: 20,
						checked: true
					},
					{
						name: '店铺单次卡',
						price: 20,
						checked: true
					},
					{
						name: '店铺单次卡',
						price: 20,
						checked: true
					},
					{
						name: '店铺单次卡',
						price: 20,
						checked: true
					},
					{
						name: '店铺单次卡',
						price: 20,
						checked: true
					},
					{
						name: '店铺单次卡',
						price: 20,
						checked: true
					},
				]
			}
		},
		methods: {
			checkedType(i) {
				this.list[i].checked = !this.list[i].checked
			},
			// 注意返回值为一个数组，单列时取数组的第一个元素即可(只有一个元素)
			submit(e) {
				this.$emit('submit', this.value)
				this.value = ''
			},
			refuse() {
				this.$emit('refuse', true)
			},
			getPhoneNumber(e) {
				// console.log(e.detail.code)
				getWxPhone({
					code: e.detail.code,
					type: 0
				}).then(res => {
					this.$emit('submit')
				})
			}
		}
	}
</script>

<style scoped lang="scss">
	::v-deep .u-icon {
		display: inline !important;
	}

	.mypop {
		width: 90%;
	}

	.scroll-content {
		display: flex;
		flex-direction: column;

		.top {
			display: flex;
			justify-content: space-between;
			margin-top: 40rpx;
			border-bottom: 0.5rpx solid rgba(217, 217, 217, 0.6);
			padding-bottom: 40rpx;

			.item {
				text-align: center;
				background: #F6F6F6;
				padding: 20rpx 40rpx;
				border-radius: 8px;

				.top1 {
					color: #081738;
					font-size: 34rpx;
				}

				.top2 {
					color: #979797;
					font-size: 28rpx;
				}
			}
		}

		.center {
			padding-bottom: 40rpx;
			padding-top: 20rpx;

			.title {}

			.list {
				display: flex;
				justify-content: space-between;
				align-items: center;

				.item {
					display: flex;
					justify-content: space-between;
					background: #C0EAE4;
					border-radius: 10px;
					width: 78%;
					padding: 30rpx;
					color: #2CB9A4;
					margin-right: 20rpx;
					margin-top: 20rpx;

					.name {}

					.price {}
				}

				.check {}
			}
		}

		.bottom {}
	}
</style>